import axios from 'axios';
let baseUrl = 'https://music.zmod.cn'

/**
 * @description 获取轮播图的api
 * @param {Number} type 
 * @returns 
 */
export function getBanner (type = 1) {
  return axios.get(`${baseUrl}/banner?type=${type}`)
}

/**
 * @description 获取推荐歌单
 * @param {Number} limit 取出数量，默认为10
 * @returns 
 */
export function getMusicList (limit = 10) {
  return axios.get(`${baseUrl}/personalized?limit=${limit}`)
}


/**
 * @description 获取歌单详情
 * @param {Number} id 歌单id
 * @returns 
 */
export function getPlayListDetail (id) {
  return axios.get(`${baseUrl}/playlist/detail?id=${id}`)
}

/**
 * @description 获取歌词
 * @param {Number} id 音乐id
 * @returns 
 */
export function getLyric (id) {
  return axios.get(`${baseUrl}/lyric?id=${id}`);
}

/**
 * @description 搜索歌曲
 * @param {String} keyword 关键词
 */
export function searchMusic (keyword) {
  return axios.get(`${baseUrl}/search?keywords=${keyword}`);
}

/**
 * @description 手机登录
 * @param {*} phone 
 * @param {*} password 
 * @returns 
 */
export function phoneLogin (phone, password) {
  return axios.get(`${baseUrl}/login/cellphone?phone=${phone}&password=${password}`);
}

/**
 * @description 获取用户详情
 * @param {*} id 
 * @returns 
 */
export function userDetail (uid) {
  return axios.get(`${baseUrl}/user/detail?uid=${uid}`)
}